package com.swy.shopgroup;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class UploadFilePathConfig implements WebMvcConfigurer {

//    @Value("E:\\ideaApplication\\shopGroup\\src\\main\\java\\com\\swy\\shopgroup\\upload\\")
//    private String uploadFilePath;
//
//    public static String uploadPath = "E:/ideaApplication/shopGroup/src/main/java/com/swy/shopgroup/upload/";
//
    @Value("D:\\shop_group\\shop_java\\src\\main\\java\\com\\swy\\shopgroup\\upload\\")
    private String uploadFilePath;

    public static String uploadPath = "D:/shop_group/shop_java/src/main/java/com/swy/shopgroup/upload/";

    @Value("/upload/**")
    private String staticAccessPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(staticAccessPath).addResourceLocations("file:" + uploadFilePath);
    }
}